// 导航栏样式
const as = document.querySelectorAll('.nav-link')
let t1 = 0
const nb = document.querySelector('.navbar')
// nb.addEventListener('mousemove',() => {
	// const width = window.innerWidth;
	// if(width > 992){
		for (let i = 0; i < as.length; i++) {
			as[i].addEventListener('mouseenter',() => {
				// console.log(i+1)
				as[i].nextElementSibling.style.display = 'block';
				setTimeout(()=>{
					as[i].nextElementSibling.classList.add('active')
				},10)
				
				// document.querySelector(`.fr ul li:nth-child(${2*(i+1)}) dl`).classList.add('active')
			})
			as[i].addEventListener('mouseleave',() => {
				// document.querySelector(`.fr ul li:nth-child(${2*(i+1)})) dl`).classList.remove('active')
				
				t1 = setTimeout(() => {
					as[i].nextElementSibling.classList.remove('active')
					setTimeout(()=>{
						as[i].nextElementSibling.style.display = 'none';
					},10)
				},150)
			})
			as[i].nextElementSibling.addEventListener('mouseenter',() => {
				clearTimeout(t1)	
			})
			as[i].nextElementSibling.addEventListener('mouseleave',() => {
				as[i].nextElementSibling.style.display = 'none';
				as[i].nextElementSibling.classList.remove('active')	
			})
		}
	// }
// })

	

// 轮播图样式
const next = document.querySelector('.carousel-control-next')
const banner = document.querySelector('.carousel')
let timeId = setInterval(() => {
    next.click()
},3000)
banner.addEventListener('mouseenter',function(){
	clearInterval(timeId)
})
banner.addEventListener('mouseleave',function(){
	clearInterval(timeId)
	timeId = setInterval(function(){
		next.click()
	},3000)
})

/*企业荣誉*/
const introduction = document.querySelectorAll('.ch_introduction')
const tips = document.querySelectorAll('.ch_tips')
for(let i = 0 ; i < tips.length ; i++){
	tips[i].addEventListener('mouseenter',() => {
		introduction[i].style.opacity = 0
		tips[i].style.opacity = 1
	})
	tips[i].addEventListener('mouseleave',() => {
		introduction[i].style.opacity = 1
		tips[i].style.opacity = 0
	})
}

let t2 = 0
const itds = document.querySelectorAll('.ch_introduction')
for (let i = 0; i < itds.length; i++) {
	const dds = document.querySelector(`.ch_content dl:nth-child(${i+1}) dd:nth-child(${2})`)
	itds[i].addEventListener('mouseenter',() => {
		dds.classList.add('active')
	})
	itds[i].addEventListener('mouseleave',() => {
		t2 = setTimeout(() => {
			dds.classList.remove('active')
		},100)
	})
	dds.addEventListener('mouseenter',() => {
		clearTimeout(t2)
	})
	dds.addEventListener('mouseleave',() => {
		dds.classList.remove('active')
	})
}